package view;

/**
 * Enumeration contains types of the user.
 * User can be expert or not
 */
public enum UserMode
{
	/**
	 * Not expert user
	 */
	STANDART,
	
	/**
	 * Expert user
	 */
	ADVANCED;
	
	/**
	 * Define function from integer to enum.
	 * @param - index of the user mode
	 * @return the user mode
	 */
	public static UserMode getUserMode(int index)
	{
		if(index == 0)
		{
			return STANDART;
		}
		else if(index == 1)
		{
			return ADVANCED;
		}

		/*N/A*/
		System.out.println("Illegal argument");
		return null;
	}
	
	/**
	 * Define function from enum to integer.
	 * @return index of the user mode
	 */
	public int toInt()
	{
		switch(this)
		{
		case STANDART:
			return 0;
		case ADVANCED:
			return 1;			
		}

		/*N/A*/
		System.out.println("Illegal argument");
		return -1;
	}
	
	/**
	 * @return the string appropriate for the enum value
	 */	
	public String toString()
	{
		switch(this)
		{
		case STANDART:
			return "Standart";
		case ADVANCED:
			return "Advanced";			
		}

		/*N/A*/
		System.out.println("Illegal argument");
		return null;
	}
}
